package com.shadow.service;

import com.shadow.domain.AccountInfo;
import com.shadow.domain.UserInfo;
import com.shadow.repository.UserDao;
import com.shadow.repository.UserDaoImpl;

/**
 * Created by qq65827 on 2014/9/2.
 */
public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    public AccountInfo createNewAccount(String user, String pwd, Integer init) {
        AccountInfo accountInfo = new AccountInfo();
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername(user);
        userInfo.setPassword(pwd);
        accountInfo.setBalance(init);
        accountInfo.setUserInfo(userInfo);
        return userDao.save(accountInfo);
    }
}
